﻿CREATE TABLE [dbo].[LibraryVersion] (
    [Id]                INT            IDENTITY (1, 1) NOT NULL,
    [Version]           VARCHAR (30)   NULL,
    [Status]            INT            NOT NULL,
    [UserId]            INT            NOT NULL,
    [LibraryId]         INT            NOT NULL,
    [LibraryFile]       VARCHAR (200)  NOT NULL,
    [ChangeDescription] VARCHAR (2048) NOT NULL,
    [Date]              DATETIME       NOT NULL,
    [Type]              INT            NOT NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF),
    FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([Id]) ON DELETE CASCADE ON UPDATE CASCADE,
    FOREIGN KEY ([LibraryId]) REFERENCES [dbo].[Library] ([Id]) ON DELETE CASCADE ON UPDATE CASCADE
);

